using FluentNHibernate.Mapping;

namespace OpenFuse.Cache.Maps
{
	public class NodeMap : ClassMap<Node>
	{
		public NodeMap()
		{
//			this.TableName = "Nodes";
			
			Id(x => x.RowId);
			Map(x => x.CreationTime);
	        Map(x => x.Id);
	        Map(x => x.Name);
		    Map(x => x.Path);
		    Map(x => x.ParentId);
		    Map(x => x.Variant);
		    Map(x => x.Version);
		    Map(x => x.DescendantCount);
		    Map(x => x.PreferredType);
		    Map(x => x.AssetId);
 			HasMany<Node>(x => x.Children)
				.WithTableName("Node")
				.WithKeyColumn("ParentId")
				.Access.AsProperty()
				.AsList();

		}
 	}
}
